package hk.linkcredit.awardservice.award.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import hk.linkcredit.awardservice.award.domain.entity.AwardRecord;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * 奖励订单Mapper接口
 *
 * @author african-loan
 * @date 2022-06-22
 */
public interface AwardRecordMapper extends BaseMapper<AwardRecord>{

    @Select("SELECT round(SUM(award_amount), 2) FROM award_record WHERE user_id = #{userId}")
    BigDecimal getAmountSum(String userId);

    List<AwardRecord> getUserInviteRecord(String userId);
}
